<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件绑定</title>
    <script src="../react/react.development.js"></script>
    <script src="../react/react-dom.development.js"></script>
    <script src="../react/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
    class Comp extends React.Component {
        clickHandler(e) {
            console.log('被点击')
            e.preventDefault()
        }

        render() {
            return (
                <a href="https://www.baidu.com" onClick={this.clickHandler}>点击</a>
            );
        }
    }

    ReactDOM.render(<Comp></Comp>, document.getElementById('root'))
</script>
</body>
</html>
